package com.work.db;

import java.io.Serializable;
import java.util.List;

import org.hibernate.criterion.Criterion;

public interface GenericDao<T, ID extends Serializable> {
	 
    T findById(ID id, boolean lock);
 
    List<T> findByCriteria(Criterion... criterion);
    
    List<T> findByNativeQuery(String nativeQuery, List<NativeQueryParam> params);
    
    List<T> findByNamedQuery(String namedQuery, List<NativeQueryParam> params);
    
    T findOneByNativeQuery(String nativeQuery, List<NativeQueryParam> params);
    
    <V> List<V> findByNativeQuery(String nativeQuery, List<NativeQueryParam> params, Class<V> resultType);
    
    <V> V findOneByNativeQuery(String nativeQuery, List<NativeQueryParam> params, Class<V> resultType);
    
    List<T> findAll();
 
    T save(T entity);
 
    void delete(T entity);
}
